package com.atguigu.gulimall.ware.dao;

import com.atguigu.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 商品库存
 * 
 * @author zhouh
 * @email zh69144@aliyun.com
 * @date 2022-01-25 16:47:05
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addStock(@PathVariable("skuId") Long skuId, @PathVariable("wareId")Long wareId, @PathVariable("skuNum")Integer skuNum);

    Boolean getSkuStock(@Param("skuId") Long id);

    Long lockSkuStock(@Param("skuId") Long skuId,@Param("wareId") Long wareId, @Param("num") Integer num);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    void unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);
}
